package isPalindrome;

import java.util.ArrayList;


public class isPalindrome {//判断回文字符
    public boolean isPalindrome(String s) {
        s = s.toLowerCase();
        StringBuilder stringBuilder1=new StringBuilder();
        int left = 0;
        int right = s.length() - 1;
        for (int i = left; i <=right; i++) {
            char ch1 = s.charAt(i);
            if(Character.isAlphabetic(ch1)){
                stringBuilder1.append(ch1);
            }
        }
        //反转
        StringBuilder stringBuilder2=new StringBuilder(stringBuilder1).reverse();
        if(stringBuilder1.toString().equals(stringBuilder2.toString())){
            return true;
        }else {
            return false;
        }
    }
}
